/**
 * 返回一个
 * 0-000
 * 1-001
 * 2-010
 * 3-011
 * 4-100
 * 数组或者查找表
 */

class MicroGRIT {
  constructor() {}
  MyList: Array<[]> = [];
  MyKeys: Array<number> = [];
  nextValue(ins: number[]): number[] {
    let len = ins.length;
    let ans = ins;
    for (let index = len - 1; index > 0; index--) {
      const element = ins[index];
      if (element == 0) {
        ans.splice(index, 1, 1);
        for (let j = index+1; j < len ; j++) {
          ans.splice(j, 1, 0);
        }
        break;
      }
      // if (element == 1) {
      //   continue;
      // }
    }

    return ans;
  }
}

let m = new MicroGRIT();
console.log(m.nextValue([0, 1, 1]));
